package com.example.demo.sensitive.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @ClassName SensitiveLevelEnum
 * @Description 敏感程度等级枚举
 * @Author System
 * @Date 2025/9/19
 **/
@Getter
@AllArgsConstructor
public enum SensitiveLevelEnum {

    LOW(1, "轻微", "#67C23A"),
    MEDIUM(2, "中等", "#E6A23C"),
    HIGH(3, "高危", "#F56C6C"),
    CRITICAL(4, "严重", "#F56C6C");

    private final Integer level;
    private final String desc;
    private final String color;

    /**
     * 根据level获取枚举
     */
    public static SensitiveLevelEnum getByLevel(Integer level) {
        for (SensitiveLevelEnum levelEnum : values()) {
            if (levelEnum.getLevel().equals(level)) {
                return levelEnum;
            }
        }
        return LOW; // 默认返回低级别
    }

    /**
     * 判断是否为高危级别
     */
    public boolean isHighRisk() {
        return this == HIGH || this == CRITICAL;
    }
}
